<%--
  Created by IntelliJ IDEA.
  User: xianfei
  Date: 15-9-16
  Time: 上午11:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<html>
<head>
    <title>我的度假屋</title>
    <mystyle>
    <link href="/public/css/myHouse.css" type="text/css" rel="stylesheet"/>
    </mystyle>
    <script type="text/javascript" src="/static/jquery-1.11.3.js"></script>
    <script>
        $(function () {
            $('.MyhouseNavIn').click(function (e) {
                $(this).addClass('current').siblings().removeClass('current');
            });

            $(".MyBuy").click(function () {
                myHouseShow();
                myChangeHouseHide();
            })

            $(".Mychange").click(function () {
                myChangeHouseShow();
                myHouseHide();
            })
//            function change(a) {
//                $('.MyhouseNavIn').eq(a).click(function (e) {
//                    $('.project').eq(a).addClass('ProjectCurrent').siblings().removeClass('ProjectCurrent');
//                });
//            }

//            change(0);
//            change(1);
            $('.MyhouseProjectHover').css('display', 'none');
            $('.MyhouseProjectAll').hover(function (e) {
                $(this).find('.MyhouseProjectHover').css('display', 'block');
            }, function () {
                $(this).find('.MyhouseProjectHover').css('display', 'none');
            });
            $('.MyhouseProjectHover a').hover(function (e) {
                $(this).addClass('Current').siblings().removeClass('Current');
            });
            $('.MychangeProjectHover').css('display', 'none');
            $('.MychangeProjectAll').hover(function (e) {
                $(this).find('.MychangeProjectHover').css('display', 'block');
            }, function () {
                $(this).find('.MychangeProjectHover').css('display', 'none');
            });
            $('.MychangeProjectHover a').hover(function (e) {
                $(this).addClass('Current').siblings().removeClass('Current');
            });
        })

        function reserve(myHouseDTOGuid) {
            location.href = "/reserve/show/" + myHouseDTOGuid;
        }
        function exchange(myHouseDTOGuid) {
            location.href = "/exchange/choose_exchange/" + myHouseDTOGuid;
        }

        function myHouseShow() {
            var myHouse = $(".MyhouseProject");
            for (var i = 0; i < myHouse.length; i++) {
                myHouse.eq(i).addClass('ProjectCurrent');
            }
        }
        function myHouseHide() {
            var myHouse = $(".MyhouseProject");
            for (var i = 0; i < myHouse.length; i++) {
                myHouse.eq(i).removeClass('ProjectCurrent');
            }
        }
        function myChangeHouseShow() {
            var myChange = $(".MychangeProject");
            for (var i = 0; i < myChange.length; i++) {
                myChange.eq(i).addClass('ProjectCurrent');
            }
        }
        function myChangeHouseHide() {
            var myChange = $(".MychangeProject");
            for (var i = 0; i < myChange.length; i++) {
                myChange.eq(i).removeClass('ProjectCurrent');
            }
        }
    </script>
</head>
<body>
<div class="MyhouseAll">
    <div class="MyhouseNav clearfix">
        <div class="MyhouseNavIn MyBuy current">
            <p>我的度假屋</p>
            <i class="MyBuyBg"></i>
        </div>

        <div class="MyhouseNavIn Mychange">
            <p>交换的度假屋</p>
            <i class="MychangeBg"></i>
        </div>
    </div>
</div>
<!-- MyhouseAll结束-->

<!--MyhouseProject 开始-->
<c:forEach items="${myHouseDTOs}" var="myHouseDTO" varStatus="status">
    <c:choose>
        <c:when test="${fn:length(myHouseDTOs)==1}">
            <div class="project MyhouseProject clearfix ProjectCurrent">
                <div class="MyhouseProjectAll MyhouseProject01 clearfix">
                    <div class="MyhouseImg">
                        <img src="/public/image/${myHouseDTO.houseInfoDTO.imageGuids[0]}" width="220" height="250">
                    </div>

                    <div class="MyhouseText">
                        <h3>${myHouseDTO.houseInfoDTO.name}</h3>

                        <p class="week">：${myHouseDTO.houseWeekDTO.name}</p>

                        <p class="housePrice">：${myHouseDTO.houseWeekDTO.price}元</p>

                        <p class="description">：${fn:substring(myHouseDTO.houseInfoDTO.houseFeature, 0, 30)}...</p>

                    </div>

                    <div class="MyhouseProjectHover">
                        <c:choose>
                            <c:when test="${myHouseDTO.usable=='true'}">
                                <c:choose>
                                    <c:when test="${myHouseDTO.exchangePoolStatus=='BOOKING'}">
                                        <a class="Current canNotUse" href="javascript:">预定</a>
                                    </c:when>
                                    <c:otherwise>
                                        <a href="javascript:reserve('${myHouseDTO.guid}')">预定</a>
                                    </c:otherwise>
                                </c:choose>
                                <c:choose>
                                    <c:when test="${myHouseDTO.exchangePoolStatus=='ACTIVITY'||myHouseDTO.exchangePoolStatus=='CHANGING'}">
                                        <a href="javascript:exchange('${myHouseDTO.guid}')">交换</a>
                                    </c:when>
                                    <c:otherwise>
                                        <a class="canNotUse" href="javascript:">交换</a>
                                    </c:otherwise>
                                </c:choose>
                                <a href="javascript:rent('${myHouseDTO.guid}')">短租</a>
                                <a href="javascript:">转让</a>
                            </c:when>
                            <c:otherwise>
                                <a href="javascript:">度假屋不可用</a>
                            </c:otherwise>
                        </c:choose>
                    </div>
                </div>
            </div>
        </c:when>
        <c:when test="${(status.index+1)%2!=0}">
            <div class="project MyhouseProject clearfix ProjectCurrent">
            <div class="MyhouseProjectAll MyhouseProject01 clearfix">
                <div class="MyhouseImg">
                    <img src="/public/image/${myHouseDTO.houseInfoDTO.imageGuids[0]}" width="220" height="250">
                </div>

                <div class="MyhouseText">
                    <h3>${myHouseDTO.houseInfoDTO.name}</h3>

                    <p class="week">：${myHouseDTO.houseWeekDTO.name}</p>

                    <p class="housePrice">：${myHouseDTO.houseWeekDTO.price}元</p>

                    <p class="description">：${fn:substring(myHouseDTO.houseInfoDTO.houseFeature, 0, 30)}...</p>

                </div>

                <div class="MyhouseProjectHover">
                    <c:choose>
                        <c:when test="${myHouseDTO.usable=='true'}">
                            <c:choose>
                                <c:when test="${myHouseDTO.exchangePoolStatus=='BOOKING'||myHouseDTO.exchangePoolStatus=='CHANGING'}">
                                    <a class="Current canNotUse" href="javascript:">预定</a>
                                </c:when>
                                <c:otherwise>
                                    <a href="javascript:reserve('${myHouseDTO.guid}')">预定</a>
                                </c:otherwise>
                            </c:choose>
                            <c:choose>
                                <c:when test="${myHouseDTO.exchangePoolStatus=='ACTIVITY'||myHouseDTO.exchangePoolStatus=='CHANGING'}">
                                    <a href="javascript:exchange('${myHouseDTO.guid}')">交换</a>
                                </c:when>
                                <c:otherwise>
                                    <a class="canNotUse" href="javascript:">交换</a>
                                </c:otherwise>
                            </c:choose>
                            <a href="javascript:rent('${myHouseDTO.guid}')">短租</a>
                            <a href="javascript:">转让</a>
                        </c:when>
                        <c:otherwise>
                            <a href="javascript:">度假屋不可用</a>
                        </c:otherwise>
                    </c:choose>
                </div>
            </div>
        </c:when>
        <c:when test="${(status.index+1)%2==0}">
            <div class="MyhouseProjectAll MyhouseProject02 clearfix">
                <div class="MyhouseImg">
                    <img src="/public/image/${myHouseDTO.houseInfoDTO.imageGuids[0]}" width="220" height="250">
                </div>

                <div class="MyhouseText">
                    <h3>${myHouseDTO.houseInfoDTO.name}</h3>
00000
                    <p class="week">：${myHouseDTO.houseWeekDTO.name}</p>

                    <p class="housePrice">：${myHouseDTO.houseWeekDTO.price}元</p>

                    <p class="description">：${fn:substring(myHouseDTO.houseInfoDTO.houseFeature, 0, 30)}...</p>
                </div>

                <div class="MyhouseProjectHover">
                    <c:choose>
                        <c:when test="${myHouseDTO.usable=='true'}">
                            <c:choose>
                                <c:when test="${myHouseDTO.exchangePoolStatus=='BOOKING'||myHouseDTO.exchangePoolStatus=='CHANGING'}">
                                    <a class="Current canNotUse" href="javascript:">预定</a>
                                </c:when>
                                <c:otherwise>
                                    <a href="javascript:reserve('${myHouseDTO.guid}')">预定</a>
                                </c:otherwise>
                            </c:choose>
                            <c:choose>
                                <c:when test="${myHouseDTO.exchangePoolStatus=='ACTIVITY'||myHouseDTO.exchangePoolStatus=='CHANGING'}">
                                    <a href="javascript:exchange('${myHouseDTO.guid}')">交换</a>
                                </c:when>
                                <c:otherwise>
                                    <a class="canNotUse" href="javascript:">交换</a>
                                </c:otherwise>
                            </c:choose>
                            <a href="javascript:rent('${myHouseDTO.guid}')">短租</a>
                            <a href="javascript:">转让</a>
                        </c:when>
                        <c:otherwise>
                            <a href="javascript:">度假屋不可用</a>
                        </c:otherwise>
                    </c:choose>
                </div>
            </div>
            </div>
        </c:when>
    </c:choose>
</c:forEach>
<!--MyhouseProject 结束-->

<!--MychangeProject 开始-->
<c:forEach items="${myChangeHouses}" var="myChangeHouse" varStatus="status">
    <c:choose>
        <c:when test="${fn:length(myChangeHouses)==1}">
            <div class="project MychangeProject clearfix">
                <div class="MychangeProjectAll MychangeProject01 clearfix">
                    <div class="MyhouseImg">
                        <img src="/public/image/${myChangeHouse.houseInfoDTO.imageGuids[0]}" width="220" height="250">
                    </div>
                    <div class="MyhouseText">
                        <h3>${myChangeHouse.houseInfoDTO.name}（交换房）</h3>

                        <p class="week">：${myChangeHouse.houseWeekDTO.name}</p>

                        <p class="housePrice">：${myChangeHouse.houseWeekDTO.price}元</p>

                        <p class="description">：${fn:substring(myChangeHouse.houseInfoDTO.houseFeature, 0, 30)}...</p>
                    </div>
                    <div class="MychangeProjectHover">
                        <c:choose>
                            <c:when test="${myChangeHouse.exchangePoolStatus=='BOOKING'}">
                                <a class="Current canNotUse" href="javascript:">预定</a>
                            </c:when>
                            <c:otherwise>
                                <a class="Current" href="javascript:reserve('${myChangeHouse.guid}')">预定</a>
                            </c:otherwise>
                        </c:choose>
                    </div>
                </div>
            </div>
        </c:when>
        <c:when test="${(status.index+1)%2!=0}">
            <div class="project MychangeProject clearfix">
            <div class="MychangeProjectAll MychangeProject01 clearfix">
                <div class="MyhouseImg">
                    <img src="/public/image/${myChangeHouse.houseInfoDTO.imageGuids[0]}" width="220" height="250">
                </div>

                <div class="MyhouseText">
                    <h3>${myChangeHouse.houseInfoDTO.name}（交换房）</h3>

                    <p class="week">：${myChangeHouse.houseWeekDTO.name}</p>

                    <p class="housePrice">：${myChangeHouse.houseWeekDTO.price}元</p>

                    <p class="description">：${fn:substring(myChangeHouse.houseInfoDTO.houseFeature, 0, 30)}...</p>
                </div>

                <div class="MychangeProjectHover">

                    <c:choose>
                        <c:when test="${myChangeHouse.exchangePoolStatus=='BOOKING'}">
                            <a class="Current canNotUse" href="javascript:">预定</a>
                        </c:when>
                        <c:otherwise>
                            <a class="Current" href="javascript:reserve('${myChangeHouse.guid}')">预定</a>
                        </c:otherwise>
                    </c:choose>
                        <%--<a href="javascript:">交换</a>--%>
                        <%--<a href="javascript:">短租</a>--%>
                        <%--<a href="javascript:">转让</a>--%>
                </div>
            </div>
        </c:when>

        <c:when test="${(status.index+1)%2==0}">
            <div class="MychangeProjectAll MychangeProject02 clearfix">
                <div class="MyhouseImg">
                    <img src="/public/image/${myChangeHouse.houseInfoDTO.imageGuids[0]}" width="220" height="250">
                </div>

                <div class="MyhouseText">
                    <h3>${myChangeHouse.houseInfoDTO.name}（交换房）</h3>

                    <p class="week">：${myChangeHouse.houseWeekDTO.name}</p>

                    <p class="housePrice">：${myChangeHouse.houseWeekDTO.price}元</p>

                    <p class="description">：${fn:substring(myChangeHouse.houseInfoDTO.houseFeature, 0, 30)}..</p>
                </div>

                <div class="MychangeProjectHover">
                    <c:choose>
                        <c:when test="${myChangeHouse.exchangePoolStatus=='BOOKING'}">
                            <a class="Current canNotUse" href="javascript:">预定</a>
                        </c:when>
                        <c:otherwise>
                            <a class="Current" href="javascript:reserve('${myChangeHouse.guid}')">预定</a>
                        </c:otherwise>
                    </c:choose>
                </div>
            </div>
            </div>
        </c:when>
    </c:choose>
</c:forEach>
<!--MychangeProject 结束-->
<div id="initRent">
    <ul id="rentBody">
        <li><label>days</label><input type="text" id="days"/></li>
        <li><label>price</label><input type="text" id="price"/></li>
        <li><label>description</label><input type="text" id="description"/></li>

    </ul>
</div>
</body>
</html>